package com.ljb.calendar_demo;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        //act=android.intent.action.EVENT_REMINDER dat=content://com.android.calendar/1491014051954
    }

    public void addEvent(View v) {
        int result = CalendarKit.init().addCalendarEvent(this, "测试", "www.baidu.com", System.currentTimeMillis() + 1000 * 10);
        if (result > 0) {
            Toast.makeText(this, "事件添加成功", Toast.LENGTH_SHORT).show();
        } else {
            Toast.makeText(this, "事件添加失败", Toast.LENGTH_SHORT).show();
        }
    }

    public void deleteEvent(View v) {
        int result = CalendarKit.init().deleteCalendarEvent(this, "测试");
        if (result > 0) {
            Toast.makeText(this, "事件删除成功", Toast.LENGTH_SHORT).show();
        } else if (result < 0) {
            Toast.makeText(this, "事件删除失败", Toast.LENGTH_SHORT).show();
        } else {
            Toast.makeText(this, "为查询到该事件", Toast.LENGTH_SHORT).show();
        }
    }

}
